﻿<UserControl x:Class="YouTubePlaylist.Views.PlaylistToolbarCtrl"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    xmlns:Controls="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Input">
    <UserControl.Resources>
        <Style x:Name="WhiteBodyStyle" TargetType="TextBlock">
            <Setter Property="Foreground" Value="White"/>
            <Setter Property="FontSize" Value="10"/>
        </Style>
        <Style x:Name="WhiteHeaderStyle" TargetType="TextBlock">
            <Setter Property="Foreground" Value="White"/>
            <Setter Property="FontSize" Value="16"/>
        </Style>
    </UserControl.Resources>
    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="Auto"/>
            <ColumnDefinition Width="*"/>
            <ColumnDefinition Width="Auto"/>
            <ColumnDefinition Width="Auto"/>
        </Grid.ColumnDefinitions>
        <StackPanel Grid.Column="0" Orientation="Horizontal" VerticalAlignment="Center">
            <TextBlock Text="Playlist:" Margin="0,0,4,0" />
            <TextBlock Text="{Binding PlaylistModel.Playlist.Name}" Margin="4,0,0,0"/>
        </StackPanel>
        <StackPanel Grid.Column="1" Orientation="Horizontal" HorizontalAlignment="Center">
            <Controls:AutoCompleteBox x:Name="TrackInput" MinWidth="250" Margin="0,4,0,4" VerticalAlignment="Center"
                                  ItemsSource="{Binding AutoCompleteTracks}"                                 
                                  FilterMode="Contains" MinimumPopulateDelay="750" MaxDropDownHeight="250"
                                  DropDownOpening="OnDropDownOpening" KeyUp="OnQuickTrackKeyUp">
                <Controls:AutoCompleteBox.ItemTemplate>
                    <DataTemplate>
                        <StackPanel Orientation="Horizontal">
                            <Button Click="OnAddTrackInline" Tag="{Binding}" VerticalAlignment="Center" Margin="0,0,4,0">
                                <Image Source="Resources/16/navigate_plus.png" Height="12"/>
                            </Button>
                            <TextBlock Text="{Binding}" VerticalAlignment="Center"/>
                        </StackPanel>
                    </DataTemplate>
                </Controls:AutoCompleteBox.ItemTemplate>
            </Controls:AutoCompleteBox>
            <Button Click="OnAddTrack" Margin="2,4,16,4">
                <StackPanel Orientation="Horizontal">
                    <Image Source="Resources/16/cd_add.png" Margin="2,0,2,0" VerticalAlignment="Center"/>
                    <TextBlock Text="Add" Margin="2,0,2,0" VerticalAlignment="Center"/>
                </StackPanel>
            </Button>
        </StackPanel>
        <Button Grid.Column="2" Click="OnAddTrackAdvanced" Margin="4">
            <StackPanel Orientation="Horizontal">
                <Image Source="Resources/16/music.png" Margin="2,0,2,0" VerticalAlignment="Center"/>
                <TextBlock Text="Add Track..." Margin="2,0,2,0" VerticalAlignment="Center"/>
            </StackPanel>
        </Button>
        <Button Grid.Column="3" Margin="4">
            <CheckBox Content="Shuffle" IsChecked="{Binding PlaylistModel.ShuffleEnabled, Mode=TwoWay}" VerticalAlignment="Center"/>
        </Button>
    </Grid>
</UserControl>
